package com.tanxi521.com.thenorthtitle.sql;


public enum SqlEnum {

    // 给予玩家称号sql
    GIVE_TITLE("insert into the_north_title_player(player_uuid,player_name,title_id,achieve_time) " +
            "values(?, ?, ?, ?)"),
    // 新建称号sql
    NEW_TITLE("insert into the_north_title " +
            "(title_name,title_price,title_rely_on,title_shop_discount,title_reward_mul,create_by,create_time,update_by,update_time,belong_to) " +
            "values(?,?,?,?,?,?,?,?,?,?)"),
    // 查询玩家称号sql
    SELECT_PLAYER_TITLE("select " +
            "tnt.id," +
            "tnt.title_name," +
            "tnt.title_price," +
            "tnt2.title_name as title_rely_on," +
            "tnt.title_reward_mul," +
            "tnt.title_shop_discount " +
            "from the_north_title_player tntn " +
            "join the_north_title tnt on tntn.title_id = tnt.id " +
            "join the_north_title tnt2 on tnt.title_rely_on = tnt2.id " +
            "where tntn.player_name = ? limit ?,?"),

    // 查询玩家未获得的称号sql
    SELECT_PLAYER_NOT_BOUGHT_TITLE("select " +
            "tnt.id," +
            "tnt.title_name," +
            "tnt.title_price," +
            "tnt2.title_name as title_rely_on," +
            "tnt.title_reward_mul," +
            "tnt.title_shop_discount " +
            "FROM the_north_title tnt " +
            "join the_north_title tnt2 on tnt.title_rely_on = tnt2.id " +
            "WHERE tnt.id NOT IN ( " +
            "SELECT title_id " +
            "FROM the_north_title_player tntp " +
            "WHERE tntp.player_name = ?) and tnt.belong_to = 'public' limit ?,?"),

    // 查询玩家是否拥有称号
    SELECT_PLAYER_HAS("SELECT count(0) from the_north_title_player where player_name = ? and title_id = ?"),

    // 设置玩家称号
    SET_USER_TITLE("update the_north_title_now set player_now_title_id = ? where player_name = ?"),

    // 获取全部称号名称
    SELECT_TITLE_ALL("SELECT title_name from the_north_title"),

    // 根据名字查询id
    SELECT_NAME("SELECT id from the_north_title WHERE title_name like concat('%',?,'%')"),

    // 查询称号信息
    SELECT_TITLE_INFO("SELECT * from the_north_title where id = ?"),

    // 没有则新增（玩家当前称号）
    INSERT_USER_NOW("insert into " +
            "the_north_title_now(player_name, " +
            "player_uuid, " +
            "player_now_title_id)" +
            "select ?,?,? " +
            "where not exists (" +
            "select player_name from the_north_title_now " +
            "where player_name=?)"),
    
    INSERT_USER_DEFAULT("insert into " +
            "the_north_title_player(player_uuid, " +
            "player_name, " +
            "title_id, " +
            "achieve_time)" +
            "select ?,?,?,? " +
            "where not exists (" +
            "select player_name from the_north_title_player " +
            "where player_name=? and title_id = 2)"),

    SELECT_IS_VIP("select count(0) from vipsys_players where player = ? and vip like VIP%")
    ;


    private final String sqlStatement;

    public String getSqlStatement() {
        return this.sqlStatement;
    }

    private SqlEnum(String sqlStatement) {
        this.sqlStatement = sqlStatement;
    }

}
